﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            MembershipUser myObject = Membership.GetUser();
            string UserID = myObject.ProviderUserKey.ToString();
            Session["UserId"] = UserID;
        }
        if(User.IsInRole("Administrator"))
        {
            AdminTest.Visible = true;
            AdminTask.Visible = true;
            StudentPerformence.Visible = true;
        }
        else if(User.IsInRole("Student"))
        {
            MembershipUser user = Membership.GetUser();
            ProfileCommon profile = (Profile as ProfileCommon).GetProfile(user.UserName);
            if (profile.FirstName.Length == 0)
                Response.Redirect("~/student/Profile.aspx");
            AdminTest.Visible = false;
            AdminTask.Visible = false;
            StudentPerformence.Visible = true;
        }
    }
}